import { IMessage, IRequest, IResponse } from "../../../Share/Module/Message/IMessage";
import { IActorMessage, IActorRequest, IActorResponse } from "../../../Share/Module/Actor/IActorMessage";
import { IActorLocationMessage, IActorLocationRequest, IActorLocationResponse } from "../../../Share/Module/ActorLocation/IActorLocationMessage";
import { MessageAttribute, ResponseTypeAttribute } from "../../../../../Decorator/Decorator";

export class OuterMessage {
    public static readonly HttpGetRouterResponse: number = 10002;
    public static readonly RouterSync: number = 10003;
    public static readonly M2C_TestResponse: number = 10004;
    public static readonly C2M_TestRequest: number = 10005;
    public static readonly Actor_TransferResponse: number = 10006;
    public static readonly Actor_TransferRequest: number = 10007;
    public static readonly G2C_EnterMap: number = 10008;
    public static readonly C2G_EnterMap: number = 10009;
    public static readonly Float3: number = 10010;
    public static readonly Quaternion: number = 10011;
    public static readonly MoveInfo: number = 10012;
    public static readonly UnitInfo: number = 10013;
    public static readonly M2C_CreateUnits: number = 10014;
    public static readonly M2C_CreateMyUnit: number = 10015;
    public static readonly M2C_StartSceneChange: number = 10016;
    public static readonly M2C_RemoveUnits: number = 10017;
    public static readonly C2M_PathfindingResult: number = 10018;
    public static readonly C2M_Stop: number = 10019;
    public static readonly M2C_PathfindingResult: number = 10020;
    public static readonly M2C_Stop: number = 10021;
    public static readonly G2C_Ping: number = 10022;
    public static readonly C2G_Ping: number = 10023;
    public static readonly R2C_Login: number = 10024;
    public static readonly C2R_Login: number = 10025;
    public static readonly G2C_LoginGate: number = 10026;
    public static readonly C2G_LoginGate: number = 10027;
    public static readonly G2C_Test: number = 10028;
    public static readonly M2C_Reload: number = 10029;
    public static readonly C2M_Reload: number = 10030;
    public static readonly G2C_TestHotfixMessage: number = 10031;
    public static readonly M2C_TestRobotCase: number = 10032;
    public static readonly C2M_TestRobotCase: number = 10033;
    public static readonly M2C_TransferMap: number = 10034;
    public static readonly C2M_TransferMap: number = 10035;
    public static readonly A2C_LoginAccount: number = 10036;
    public static readonly C2A_LoginAccount: number = 10037;
    public static readonly A2C_Disconnect: number = 10038;
    public static readonly A2C_GetServerInfos: number = 10039;
    public static readonly ServerInfoProto: number = 10040;
    public static readonly C2A_GetServerInfos: number = 10041;
    public static readonly RoleInfoProto: number = 10042;
    public static readonly A2C_CreateRole: number = 10043;
    public static readonly C2A_CreateRole: number = 10044;
    public static readonly A2C_GetRoles: number = 10045;
    public static readonly C2A_GetRoles: number = 10046;
    public static readonly A2C_DeleteRole: number = 10047;
    public static readonly C2A_DeleteRole: number = 10048;
    public static readonly A2C_GetRealmKey: number = 10049;
    public static readonly C2A_GetRealmKey: number = 10050;
    public static readonly R2C_LoginRealm: number = 10051;
    public static readonly C2R_LoginRealm: number = 10052;
    public static readonly G2C_LoginGameGate: number = 10053;
    public static readonly C2G_LoginGameGate: number = 10054;
    public static readonly G2C_EnterGame: number = 10055;
    public static readonly C2G_EnterGame: number = 10056;
}

@MessageAttribute(OuterMessage.HttpGetRouterResponse)
export class HttpGetRouterResponse {
    Realms: string[];
    Routers: string[];
}

@MessageAttribute(OuterMessage.RouterSync)
export class RouterSync {
    ConnectId: number;
    Address: string;
}

@MessageAttribute(OuterMessage.M2C_TestResponse)
export class M2C_TestResponse extends IActorLocationResponse {
    RpcId: number;
    Error?: number;
    Message?: string;
    Response: string;
}

@ResponseTypeAttribute(M2C_TestResponse)
@MessageAttribute(OuterMessage.C2M_TestRequest)
export class C2M_TestRequest extends IActorLocationRequest {
    RpcId: number;
    Request: string;
}

@MessageAttribute(OuterMessage.Actor_TransferResponse)
export class Actor_TransferResponse extends IActorLocationResponse {
    RpcId: number;
    Error?: number;
    Message?: string;
}

@ResponseTypeAttribute(Actor_TransferResponse)
@MessageAttribute(OuterMessage.Actor_TransferRequest)
export class Actor_TransferRequest extends IActorLocationRequest {
    RpcId: number;
    MapIndex: number;
}

@MessageAttribute(OuterMessage.G2C_EnterMap)
export class G2C_EnterMap extends IResponse {
    RpcId: number;
    Error?: number;
    Message?: string;
    MyId: number;
}

@ResponseTypeAttribute(G2C_EnterMap)
@MessageAttribute(OuterMessage.C2G_EnterMap)
export class C2G_EnterMap extends IRequest {
    RpcId: number;
}

@MessageAttribute(OuterMessage.Float3)
export class Float3 {
    x?: number;
    y?: number;
    z?: number;
}

@MessageAttribute(OuterMessage.Quaternion)
export class Quaternion {
    x?: number;
    y?: number;
    z?: number;
    w?: number;
}

@MessageAttribute(OuterMessage.MoveInfo)
export class MoveInfo {
    Points: Float3;
    Rotation: Quaternion;
    TurnSpeed: number;
}

@MessageAttribute(OuterMessage.UnitInfo)
export class UnitInfo {
    UnitId: number;
    ConfigId: number;
    Type: number;
    Position: Float3;
    Forward: Float3;
    MoveInfo: MoveInfo;
}

@MessageAttribute(OuterMessage.M2C_CreateUnits)
export class M2C_CreateUnits extends IActorMessage {
    Units: UnitInfo[];
}

@MessageAttribute(OuterMessage.M2C_CreateMyUnit)
export class M2C_CreateMyUnit extends IActorMessage {
    Unit: UnitInfo;
}

@MessageAttribute(OuterMessage.M2C_StartSceneChange)
export class M2C_StartSceneChange extends IActorMessage {
    SceneInstanceId: number;
    SceneName: string;
}

@MessageAttribute(OuterMessage.M2C_RemoveUnits)
export class M2C_RemoveUnits extends IActorMessage {
    Units: number;
}

@MessageAttribute(OuterMessage.C2M_PathfindingResult)
export class C2M_PathfindingResult extends IActorLocationMessage {
    RpcId: number;
    Position: Float3;
}

@MessageAttribute(OuterMessage.C2M_Stop)
export class C2M_Stop extends IActorLocationMessage {
    RpcId: number;
}

@MessageAttribute(OuterMessage.M2C_PathfindingResult)
export class M2C_PathfindingResult extends IActorMessage {
    Id: number;
    Position: Float3;
    Points: Float3[];
}

@MessageAttribute(OuterMessage.M2C_Stop)
export class M2C_Stop extends IActorMessage {
    Error: number;
    Id: number;
    Position: Float3;
    Rotation: Quaternion;
}

@MessageAttribute(OuterMessage.G2C_Ping)
export class G2C_Ping extends IResponse {
    RpcId: number;
    Error?: number;
    Message?: string;
    Time: number;
}

@ResponseTypeAttribute(G2C_Ping)
@MessageAttribute(OuterMessage.C2G_Ping)
export class C2G_Ping extends IRequest {
    RpcId: number;
}

@MessageAttribute(OuterMessage.R2C_Login)
export class R2C_Login extends IResponse {
    RpcId: number;
    Error?: number;
    Message?: string;
    Address: string;
    Key: number;
    GateId: number;
}

@ResponseTypeAttribute(R2C_Login)
@MessageAttribute(OuterMessage.C2R_Login)
export class C2R_Login extends IRequest {
    RpcId: number;
    Account: string;
    Password: string;
}

@MessageAttribute(OuterMessage.G2C_LoginGate)
export class G2C_LoginGate extends IResponse {
    RpcId: number;
    Error?: number;
    Message?: string;
    PlayerId: number;
}

@ResponseTypeAttribute(G2C_LoginGate)
@MessageAttribute(OuterMessage.C2G_LoginGate)
export class C2G_LoginGate extends IRequest {
    RpcId: number;
    Key: number;
    GateId: number;
}

@MessageAttribute(OuterMessage.G2C_Test)
export class G2C_Test extends IMessage {
}

@MessageAttribute(OuterMessage.M2C_Reload)
export class M2C_Reload extends IResponse {
    RpcId: number;
    Error?: number;
    Message?: string;
}

@ResponseTypeAttribute(M2C_Reload)
@MessageAttribute(OuterMessage.C2M_Reload)
export class C2M_Reload extends IRequest {
    RpcId: number;
    Account: string;
    Password: string;
}

@MessageAttribute(OuterMessage.G2C_TestHotfixMessage)
export class G2C_TestHotfixMessage extends IMessage {
    Info: string;
}

@MessageAttribute(OuterMessage.M2C_TestRobotCase)
export class M2C_TestRobotCase extends IActorLocationResponse {
    RpcId: number;
    Error?: number;
    Message?: string;
    N: number;
}

@ResponseTypeAttribute(M2C_TestRobotCase)
@MessageAttribute(OuterMessage.C2M_TestRobotCase)
export class C2M_TestRobotCase extends IActorLocationRequest {
    RpcId: number;
    N: number;
}

@MessageAttribute(OuterMessage.M2C_TransferMap)
export class M2C_TransferMap extends IActorLocationResponse {
    RpcId: number;
    Error?: number;
    Message?: string;
}

@ResponseTypeAttribute(M2C_TransferMap)
@MessageAttribute(OuterMessage.C2M_TransferMap)
export class C2M_TransferMap extends IActorLocationRequest {
    RpcId: number;
}

@MessageAttribute(OuterMessage.A2C_LoginAccount)
export class A2C_LoginAccount extends IResponse {
    RpcId: number;
    Error?: number;
    Message?: string;
    Token?: string;
    AccountId?: number;
}

@ResponseTypeAttribute(A2C_LoginAccount)
@MessageAttribute(OuterMessage.C2A_LoginAccount)
export class C2A_LoginAccount extends IRequest {
    RpcId: number;
    AccountName: string;
    Password: string;
}

@MessageAttribute(OuterMessage.A2C_Disconnect)
export class A2C_Disconnect extends IMessage {
    Error: number;
}

@ResponseTypeAttribute(A2C_LoginAccount)
@MessageAttribute(OuterMessage.A2C_GetServerInfos)
export class A2C_GetServerInfos extends IResponse {
    RpcId: number;
    Error?: number;
    Message?: string;
    ServerInfosList?: ServerInfoProto[];
}

@MessageAttribute(OuterMessage.ServerInfoProto)
export class ServerInfoProto {
    Id: number;
    Status: number;
    ServerName: string;
}

@ResponseTypeAttribute(A2C_GetServerInfos)
@MessageAttribute(OuterMessage.C2A_GetServerInfos)
export class C2A_GetServerInfos extends IRequest {
    RpcId: number;
    Token: string;
    AccountId: number;
}

@MessageAttribute(OuterMessage.RoleInfoProto)
export class RoleInfoProto {
    Id: number;
    Name: string;
    State: number;
    AccountId: number;
    LastLoginTime: number;
    CreateTime: number;
    ServerId: number;
}

@MessageAttribute(OuterMessage.A2C_CreateRole)
export class A2C_CreateRole extends IResponse {
    RpcId: number;
    Error?: number;
    Message?: string;
    RoleInfo?: RoleInfoProto;
}

@ResponseTypeAttribute(A2C_CreateRole)
@MessageAttribute(OuterMessage.C2A_CreateRole)
export class C2A_CreateRole extends IRequest {
    RpcId: number;
    Token: string;
    AccountId: number;
    Name: string;
    ServerId: number;
}

@MessageAttribute(OuterMessage.A2C_GetRoles)
export class A2C_GetRoles extends IResponse {
    RpcId: number;
    Error?: number;
    Message?: string;
    RoleInfo?: RoleInfoProto[];
}

@ResponseTypeAttribute(A2C_GetRoles)
@MessageAttribute(OuterMessage.C2A_GetRoles)
export class C2A_GetRoles extends IRequest {
    RpcId: number;
    Token: string;
    AccountId: number;
    ServerId: number;
}

@MessageAttribute(OuterMessage.A2C_DeleteRole)
export class A2C_DeleteRole extends IResponse {
    RpcId: number;
    Error?: number;
    Message?: string;
    DeletedRoleInfoId: number;
}

@ResponseTypeAttribute(A2C_DeleteRole)
@MessageAttribute(OuterMessage.C2A_DeleteRole)
export class C2A_DeleteRole extends IRequest {
    RpcId: number;
    Token: string;
    AccountId: number;
    RoleInfoId: number;
    ServerId: number;
}

@MessageAttribute(OuterMessage.A2C_GetRealmKey)
export class A2C_GetRealmKey extends IResponse {
    RpcId: number;
    Error?: number;
    Message?: string;
    RealmKey?: string;
    RealmAddress?: string;
}

@ResponseTypeAttribute(A2C_GetRealmKey)
@MessageAttribute(OuterMessage.C2A_GetRealmKey)
export class C2A_GetRealmKey extends IRequest {
    RpcId: number;
    Token: string;
    ServerId: number;
    AccountId: number;
}

@MessageAttribute(OuterMessage.R2C_LoginRealm)
export class R2C_LoginRealm extends IResponse {
    RpcId: number;
    Error?: number;
    Message?: string;
    GateSessionKey: string;
    GateAddress: string;
}

@ResponseTypeAttribute(R2C_LoginRealm)
@MessageAttribute(OuterMessage.C2R_LoginRealm)
export class C2R_LoginRealm extends IRequest {
    RpcId: number;
    AccountId: number;
    RealmTokenKey: string;
}

@MessageAttribute(OuterMessage.G2C_LoginGameGate)
export class G2C_LoginGameGate extends IResponse {
    RpcId: number;
    Error?: number;
    Message?: string;
    PlayerId?: number;
}

@ResponseTypeAttribute(G2C_LoginGameGate)
@MessageAttribute(OuterMessage.C2G_LoginGameGate)
export class C2G_LoginGameGate extends IRequest {
    RpcId: number;
    Key: string;
    RoleId: number;
    Account: number;
}

@MessageAttribute(OuterMessage.G2C_EnterGame)
export class G2C_EnterGame extends IResponse {
    RpcId: number;
    Error?: number;
    Message?: string;
    MyId: number;
}

@ResponseTypeAttribute(G2C_EnterGame)
@MessageAttribute(OuterMessage.C2G_EnterGame)
export class C2G_EnterGame extends IRequest {
    RpcId: number;
}
